Update Video Clip Status
Description
The update_status
function updates the status of a video clip using its unique ID. The status is set to the value provided and is applied using a PATCH
request to the web service.
Function Signature:
def update_status(ws_config: WebServiceConfig, video_clip_id: int, status: int) -> tuple[int, str]:
Parameters
- ws_config (WebServiceConfig): Configuration object for the web service.
- video_clip_id (int): The unique ID of the video clip to update.
- status (int): The status value to update for the video clip.
Returns
- tuple[int, str]: A tuple containing:
- response_code: The HTTP response code from the server (e.g., 200 for success).
- response_string: The response body from the server, which may include information about the update or errors.
Example Usage
ws_config = WebServiceConfig(base_url="https://api.actionstreamer.com")
video_clip_id = 1234
status = 1 # Example status value
response_code, response_string = update_status(ws_config, video_clip_id, status)
print(response_code, response_string)
Behavior
- Creates a list of operations to update the status of the video clip.
- Sends a
PATCH
request tov1/videoclip/{video_clip_id}
to apply the status update. - Returns the response code and response string from the API.
Error Handling
- If an exception occurs:
- Sets the response code to
-1
. - Logs the filename and line number where the error occurred.
- Returns an error message with details of the exception.
- Sets the response code to